#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 9

int main() {
	srand(time(NULL));
	int a[N + 1] = { 0 }, i, num, c;
	for (i = 0; i < N; i++) a[i] = (i == 0 ? 0 : a[i - 1]) + rand() % 10;
	for (i = 0; i < N; i++) printf("%d\t", a[i]);
	printf("\n");

	scanf("%d", &num);

	for (i = 0; i<N && num>a[i]; i++);
	for (; i < N + 1; i++) {
		c = num;
		num = a[i];
		a[i] = c;
	}

	for (i = 0; i < N + 1; i++) printf("%d\t", a[i]);
	printf("\n");

	return 0;
}